{ include file="../Common/head_authority.html" }
<body>
<div class="container-fluid">
    <div class="row" style="margin: 20px 0px;">
        <b>权限列表</b>
        <a href="{$smarty.const.__APP__}?c=Authority&m=addAccess" style="float: right;">添加权限</a>
    </div>
    <table class="table table-hover">
        <thead>
        <tr>
            <th>权限</th>
            <th>图标</th>
            <th>Urls</th>
            <th>操作</th>
        </tr>
        </thead>
        { foreach from="$accessData" item="v" }
        <tr>
            <td class="col-sm-2 col-md-2 col-lg-2">{$v.title}</td>
            <td class="col-sm-2 col-md-2 col-lg-2">
                {if $v.level eq 0}
                <span class="glyphicon {$v.icon_class}"></span>
                {/if}
            </td>
            <td class="col-sm-4 col-md-5 col-lg-5" title="{$smarty.const.__APP__}?c={$v.control}&m={$v.method}" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
                {if $v.level eq 0}
                {else}
                {$smarty.const.__APP__}?c={$v.control}&m={$v.method}
                {/if}
            </td>
            <td class="col-sm-3 col-md-3 col-lg-3">
                <a href="{$smarty.const.__APP__}?c=Authority&m=editAccess&id={$v.id}" class="btn btn-success btn-xs">编辑</a>
                <button type="button" onclick="access_del('{$v.id}')" class="btn btn-danger btn-xs">删除</button>
            </td>
        </tr>
        { /foreach }
    </table>
    <div class="col-sm-12 col-md-12 col-lg-12 pagination">
        <a href="#" class="pagination-info">共条<b>{$data.sumRows}</b>记录，本页显示<b>{$data.startRows}-{$data.endRows}</b></a>&nbsp;
        <a href="#" class="pagination-info">{$data.currentPage}/{$data.sumPage}</a>&nbsp;
        <a href="{$smarty.const.__APP__}" class="pagination-link">首页</a>
        <a href="{$smarty.const.__APP__}?c=Authority&m=accessList&page={$data.prePage}" class="pagination-link">上一页</a>
        <a href="{$smarty.const.__APP__}?c=Authority&m=accessList&page={$data.nextPage}" class="pagination-link">下一页</a>
        <a href="{$smarty.const.__APP__}?c=Authority&m=accessList&page={$data.sumPage}" class="pagination-link">尾页</a>&nbsp;&nbsp;
        <input type="text" class="jumpPage" id="jumpPage"/>
        <a href="#" class="pagination-link" id="pagination-jump">跳转</a>
    </div>
</div>
{literal}
<script type="text/javascript">
    $('#pagination-jump').click(function(){
        var page = $('#jumpPage').val();
        location.href = './index.php?c=Authority&m=accessList&page='+page;
    })
    function access_del(id){
        if(confirm("确定删除该权限吗？")){
            location.href = "./admin.php?c=Authority&m=accessDel&id="+id;
        }
    }
</script>
{/literal}
</body>
</html>